package com.mfw.springboot.service;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;

import com.mfw.springboot.common.DataGroupByDateDTO;
import com.mfw.springboot.model.dto.fileInfo.FileInfoQueryRequest;
import com.mfw.springboot.model.entity.FileInfo;
import com.mfw.springboot.model.vo.FileInfoVO;
import org.springframework.web.multipart.MultipartFile;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.Date;
import java.util.List;

/**
 * 文件信息服务
 *
 * @author tws
 * @from <a href="https://gitee.com/hanhuaifei/projects">我的gitee</a>
 * @Date 2024/11/20
 */
public interface FileInfoService extends IService<FileInfo> {

    /**
     * 上传
     * @param file
     */
    String upload(MultipartFile file,HttpServletRequest request) throws IOException;

    /**
     * 下载
     * @param fileUUID
     * @param response
     * @throws IOException
     */
    void download(String fileUUID, HttpServletResponse response) throws IOException;

    /**
     * 分按日期分组查询任务管理信息新增数量
     *
     * @param beginDate 开始时间
     * @param endDate   结束时间
     * @return
     */
    List<DataGroupByDateDTO> countByDay(Date beginDate, Date endDate);


    /**
     * 校验数据
     *
     * @param fileInfo
     * @param add 对创建的数据进行校验
     */
    void validFileInfo(FileInfo fileInfo, boolean add);

    /**
     * 获取查询条件
     *
     * @param fileInfoQueryRequest
     * @return
     */
    QueryWrapper<FileInfo> getQueryWrapper(FileInfoQueryRequest fileInfoQueryRequest);
    
    /**
     * 获取文件信息封装
     *
     * @param fileInfo
     * @param request
     * @return
     */
    FileInfoVO getFileInfoVO(FileInfo fileInfo, HttpServletRequest request);

    /**
     * 分页获取文件信息封装
     *
     * @param fileInfoPage
     * @param request
     * @return
     */
    Page<FileInfoVO> getFileInfoVOPage(Page<FileInfo> fileInfoPage, HttpServletRequest request);
}
